import sys, os
import numpy as np
import matplotlib.pyplot as plt
# Import the aims module
from soma import aims
# the brainplot package
import colorado as cld
print(sys.version)
Colorado has a draw function that choses the best representation according to the type of the first calling argument.
The object that can be drawn are:
for each of these objects a more specific function exist that has more adcanced options (e.g. cld.draw_volume).
The draw() function can plot numpy arrays, in this case the type of object is inferred by the array dimensions:
Sets of points defined by their 3D coordinates
bucket_map = aims.read('../data/LAbby_New.bck')
cld.draw(bucket_map)
Representation of voxel images. Voxel images are represented in the same way as buckets, i.e. with a set of points.
vol = aims.read('../data/subject01.nii')
cld.draw(vol,
downsample=2, # downsample the voxels in the volume
max_points=5000, # number of randomly sampled points to plot (low => fast)
th_min=950, # voxels below this value will not be plotted
th_max=1000 # voxels above this value will not be plotted
)
Meshes are surfaces represented as a set of simple polygons.
meshR = aims.read('../data/subject01_Rhemi.mesh')
meshL = aims.read('../data/subject01_Lhemi.mesh')
cld.draw([meshL, meshR])
Any optional argument passed to draw() which is not defined in the prototype, is directly passed to the underlying Plotly function.
For example the marker argument can be used to change size, shape and color of the points in a bucket plot.
See "3D Scatter Plot" in Plotly's documentation for a complete definition of all available options.
cld.draw(bucket_map, marker=dict(color='red'))